package com.list88zhu.android.sunflower.jetpack.room;

import android.arch.paging.DataSource;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

/**
 * <pre><code>
 *
 *  </code></pre>
 *
 * @author zhuyingming@qmtv.com
 * @date 2018/8/26
 */
@Dao
public interface PlantDao {

    @Query("SELECT * FROM PLANT")
    List<Plant> getAllPlants();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertPlant(Plant plant);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    void updatePlant(Plant plant);

    @Query("SELECT * FROM PLANT")
    DataSource.Factory<Integer, Plant> queryPlants();
}
